package com.shuangti.webdemo.config;

import com.shuangti.webdemo.intercepter.MyInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@RequiredArgsConstructor
public class InterceptorConfig implements WebMvcConfigurer {

    private final MyInterceptor interceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
    //添加一个拦截器
        registry.addInterceptor(interceptor).addPathPatterns("/**").excludePathPatterns();

    }
}
